package com.edu.edu.week_project01.activity.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;


import java.util.List;

/**
 * Created by Administrator on 9/19 0019.
 */
public class MyPageAdapter extends FragmentPagerAdapter{

    private List<Fragment> mList;
    private List<String> mTitles;

    public MyPageAdapter(FragmentManager fm,List<Fragment>list,List<String> titles) {
        super(fm);
        this.mList = list;
        this.mTitles = titles;
    }

    @Override
    public Fragment getItem(int position) {
        return mList.get(position);
    }

    @Override
    public int getCount() {
        return mList.size();
    }
//    配置标题的方法
    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles.get(position);
    }
}
